<?php

/**
 * default actions.
 *
 * @package    sf_sandbox
 * @subpackage default
 * @author     alexey.shapran@gmail.com
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class defaultActions extends sfActions
{
	/**
	 * Executes index action
	 *
	 * @param sfRequest $request A request object
	 */
	public function executeIndex(sfWebRequest $request)
	{
		/*$this->redirect('pages/index');*/
	}
	public function executeError404()
	{
		 
	}
	
	/**
	 * Disallow user to have a blog
	 * @author	Malichenko Oleg [e-mail : aluminium1989@hotmail.com]
	 * @param		int id - User ID
	 * @return		
	 */
	
	public function executeDisallowblog(sfWebRequest $request) 
	{
		$id = $request->getParameter('id');
	 	$user = Doctrine::getTable('sfGuardUser')->findOneBy('id', $id);
	 	$user->setBlogStatus('disabled');
		$user->save();
		$this->redirect('default/index');
	}
	
	public function executeMakehimblogger(sfWebRequest $request)
	{
		 $id = $request->getParameter('id');
		 $user = Doctrine::getTable('sfGuardUser')->findOneBy('id', $id);
		 $user->setBlogStatus('enabled');
		 $user->save();
		 $this->redirect('default/index');
	}
	
	
	/**
	 * Disallow provide Catalog
	 * @author	Malichenko Oleg [e-mail : aluminium1989@hotmail.com]
	 * @param		int id
	 * @return		
	 */
	
	public function executeDisallowcatalog(sfWebRequest $request)
	{
		 $id = $request->getParameter('id');
		 $user = Doctrine::getTable('sfGuardUser')->findOneBy('id', $id);
		 $user->setBalance('-2');
		 $user->save();
		 $this->redirect('default/index');
	}
	public function executeMakehimcataloger(sfWebRequest $request)
	{
		 $id = $request->getParameter('id');
		 $user = Doctrine::getTable('sfGuardUser')->findOneBy('id', $id);
		 $user->setBalance('1');
		 $user->save();
		 $this->redirect($this->generateUrl('homepage').'/sf_guard_user/'.$id.'/edit' );
	}
}
